package com.tomehay.termprojectmanage_server.mapper;

import com.tomehay.termprojectmanage_server.pojo.Model.Student;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author tomehay
 * @since 2023-06-20
 */
public interface StudentMapper extends BaseMapper<Student> {
    @Select("SELECT count(*) FROM student WHERE student.clazz_id = #{id}")
    Integer GetCounts(int id);

    Integer insertBatchSomeColumn(Collection<Student> entityList);

    @Select("SELECT student.*" + "from student,course_clazz " +
            "WHERE course_clazz.course_id = #{course_id} AND course_clazz.clazz_id =student.clazz_id " +
            "AND student.id not in " +
            "(SELECT group_member.student_id " +
            "from group_member,student_group " +
            "WHERE student_group.batch_id = #{batch_id} " +
            "AND group_member.group_id =student_group.id)" +
            "GROUP BY student.id")
    List<Student> GetUnGroupedStudent(int course_id,int batch_id);
}
